# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:pyside_checkbut.py
@Time:2022/3/21 10:10

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from PySide2.QtWidgets import QApplication, QMessageBox,QTreeWidgetItem,QInputDialog
from PySide2.QtUiTools import QUiLoader
class Stats:

    def __init__(self):
        # 从文件中加载UI定义

        # 从 UI 定义中动态 创建一个相应的窗口对象
        # 注意：里面的控件对象也成为窗口对象的属性了
        # 比如 self.ui.button , self.ui.textEdit
        self.ui = QUiLoader().load(r'C:\Users\hsk\PycharmProjects\vdcode5\ui\checkbut.ui')
        self.ui.checkBox1.setChecked(True)
        self.ui.checkBox1.stateChanged.connect(self.check)

    def check(self):
        if self.ui.checkBox1.isChecked():
            print("ischecked")
        else:
            print("not checked")

app = QApplication([])
stats = Stats()
stats.ui.show()
app.exec_()